import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const Layout = () => import("../views/Layout/index.vue");
const Login = () => import("../views/Login/index.vue");
const Home = () => import("../views/Home/index.vue");
const Goods = () => import("../views/Goods/index.vue");
const Order = () => import("../views/Order/index.vue");
const Advert = () => import("../views/Advert/index.vue");
const Params = () => import("../views/Params/index.vue");
const User = () => import("../views/User/index.vue");
const routes = [
  {
    path: "/",
    component: Layout,
    children: [
      {
        path: "/home",
        name:"home",
        component: Home
      },
      {
        path: "/goods",
        name: "goods",
        component: Goods
      },
      {
        path: "/advert",
        name: "advert",
        component: Advert
      },
      {
        path: "/Order",
        name: "Order",
        component: Order
      },
      {
        path: "/params",
        name: "params",
        component: Params
      },
      {
        path: "/user",
        name: "user",
        component: User
      }
    ]
  },
  {
    path: "/login",
    name: "login",
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history', // 设置为哈希模式若要更改为本地模式可以添加history
  base: process.env.BASE_URL,
  routes,
})


export default router
